package com.databias.j15;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;



public class GShape implements GObject {

	private Shape myShape; 
	public void draw(int x, int y, Graphics2D gs) {

		gs.setColor(Color.BLACK);
		gs.setStroke(new BasicStroke(1f));
		
		Point p = new Point (x,y);
		
		// I hate to do this, but depending on the shape, we do different draws
		
		// FIXME: this might not be necessary with the transformation
		if (myShape instanceof java.awt.Rectangle) 
		{
			((java.awt.Rectangle)myShape).setLocation(p);
				
		}

		AffineTransform tx = new AffineTransform();
		tx.translate(x,y);
		Shape newShape = tx.createTransformedShape(myShape);
		gs.draw(newShape);
	
		//gs.draw(myShape);
		//gs.draw(myShape,x,y);

	}
	
	public GShape (Shape s)
	{
		myShape=s;
	}

}
